﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml;


public partial class Profesores_DetalleNotaAlumno : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Response.Write(Request.QueryString["IdAlumno"]);
        ShowData(Request.QueryString["IdAlumno"]);
    }


    void ShowData(string idAlumnoCurso)
    {

        XmlDataAlumnos xdalumnos = new XmlDataAlumnos();

        XmlDocument osource = xdalumnos.getDataNota(biFactory.IdCurso, biFactory.IdMateria, biFactory.Per);

        XmlElement oelm = (XmlElement)osource.SelectSingleNode("/alumnos/alumno[@idAlumnoCurso=" + idAlumnoCurso + "]");

        DataTable dt = new DataTable("Alumno");
        DataRow r = dt.NewRow();
        DataColumn c;

        c = new DataColumn("ID");
        
        c.DataType = System.Type.GetType("System.Int32");
        c.Unique = true;
        c.AutoIncrement = true;
        c.AutoIncrementSeed = 1;
        c.AutoIncrementStep = 1;
        dt.Columns.Add(c);

        c = new DataColumn("Modalidad");
        c.DataType = System.Type.GetType("System.String");
        c.MaxLength = 60;
        dt.Columns.Add(c);

        for(int i=0; i<10;i++){
            r = dt.NewRow();
            r["Modalidad"]= "Elemen" + i.ToString();
            dt.Rows.Add(r);
        }

        DataSet ds = new DataSet("mio");
        ds.Tables.Add(dt);

        XmlDocument oDs = new XmlDocument();
        oDs.LoadXml(           ds.GetXml());
        oDs.Save("d:\\ds.xml");

    GridView1.DataSource=dt;
    GridView1.DataBind();

        


        Xml1.Document = osource;
//        Xml1.TransformSource = biFactory.Materia().oPlanilla().FileDetalleCarga;

        Xml1.Visible = true;


    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        Response.Write(e.ToString());
    }
    protected void Guardar_Click(object sender, EventArgs e)
    {
        foreach (GridViewRow rg in GridView1.Rows)
        {
            Response.Write(((System.Web.UI.WebControls.TextBox)(rg.Controls[1].Controls[3])).Text);
            Response.Write( rg.Controls.Count +"-"+ rg.Controls[0] );
        }

    }
    protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
    {
        
    }
}
